package com.nbsaas.boot.trade.rest.convert;

import com.nbsaas.boot.trade.data.entity.TradeStream;
import com.nbsaas.boot.trade.api.domain.simple.TradeStreamSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* -列表对象转换器
*/

public class TradeStreamSimpleConvert implements Converter<TradeStreamSimple, TradeStream> {




@Override
public TradeStreamSimple convert(TradeStream source) {
    TradeStreamSimple result = new TradeStreamSimple();

                result.setNote(source.getNote());
                result.setAmount(source.getAmount());

                try {
                    if(source.getAccount()!=null){
                        result.setAccountName(source.getAccount().getName());
                    }
                } catch (Exception ignored) { }

                result.setChangeType(source.getChangeType());
                result.setAddDate(source.getAddDate());
                result.setSerialNo(source.getSerialNo());
                result.setPreAmount(source.getPreAmount());
                result.setOriginType(source.getOriginType());
                result.setDataId(source.getDataId());
                result.setId(source.getId());
                result.setAfterAmount(source.getAfterAmount());

               try {
                   if(source.getAccount()!=null){
                       result.setAccount(source.getAccount().getId());
                   }
                } catch (Exception ignored) { }


               try {
                   if(source.getInfo()!=null){
                       result.setInfo(source.getInfo().getId());
                   }
                } catch (Exception ignored) { }

                result.setLastDate(source.getLastDate());


    return result;
}

}